#ifndef __TINYSRV_THREAD_H__
#define __TINYSRV_THREAD_H__

#include "exception.h"
#include "non_copyable.h"
#include "icallback.h"

#include <memory>

#include <pthread.h>


namespace tinySrv
{

  DECLARE_TINYSRV_EXCEPTION(Thread)
  
  class Thread
    : NonCopyable
  {
  public:
    typedef std::auto_ptr<ICallback> ICallbackPtr;

    Thread(ICallbackPtr callback);
    ~Thread();
    
  private:
    ICallbackPtr Callback;
    pthread_t Handle;

    static void* ThreadProc(void *prm);
  };

}

#endif  // !__TINYSRV_THREAD_H__
